#include "MainWindow.h"
#include "ui_MainWindow.h"
#include "QFileDialog"

#define DEFAULT_ANIM_FILE      "/home/joseps/Desktop/jordi/Manitou_2.txt"


MainWindow::MainWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    ui->FileNameAnim_->setText(QString());

    ui->Miradas_->LoadSceneFile( QString(DEFAULT_ANIM_FILE) );
    ui->Miradas_->LoadAnimationFile(QString( DEFAULT_ANIM_FILE ));
    ui->Miradas_->SetBackgroundColor(Qt::white);
    ui->Miradas_->setMinimumSize(800,600);

//    ui->Miradas_->StartAnimation();
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_ButtonBrowseAnim__clicked()
{
    QString AnimFileName = QFileDialog::getOpenFileName(this, tr("Animation File"), DEFAULT_ANIM_FILE,
                                                    tr("Text Files (*.txt)"));
    if (!AnimFileName.isNull())
    {
        ui->FileNameAnim_->setText( AnimFileName );
    }
}

void MainWindow::on_ButtonBrowseScene__clicked()
{
    QString SceneFileName = QFileDialog::getOpenFileName(this, tr("Scene File"), "/home",
                                                    tr("Scene Files (*.scn);; Text Files (*.txt)"));
    if (!SceneFileName.isNull())
    {
        ui->FileNameScene_->setText( SceneFileName );
    }
}
